var phonecatControllers = angular.module('phonecatControllers', [])

phonecatControllers.controller('SelfCtrl', function ($scope) {
    $scope.click = function () {
        $scope.$broadcast('to-child', 'child');
        $scope.$broadcast('to-parent', 'parentparent');
        $scope.$emit('to-parent', 'parent');
    }
});
phonecatControllers.controller('ParentCtrl', function ($scope) {
    $scope.$on('to-parent', function (d, data) {
        console.log("ParentCtrl---to-parent:" + d + "," + data);         //父级能得到值
    });
    $scope.$on('to-child', function (d, data) {
        console.log("ParentCtrl---to-child:" + d + "," + data);         //子级得不到值
    });
});
phonecatControllers.controller('ChildCtrl', function ($scope) {
    $scope.$on('to-child', function (d, data) {
        console.log("ChildCtrl---to-child:" + d + "," + data);         //子级能得到值
    });
    $scope.$on('to-parent', function (d, data) {
        console.log("ChildCtrl---to-parent:" + d + "," + data);         //父级得不到值
    });
});
phonecatControllers.controller('BroCtrl', function ($scope) {
    $scope.$on('to-parent', function (d, data) {
        console.log("BroCtrl---to-parent:" + d + "," + data);        //平级得不到值
    });
    $scope.$on('to-child', function (d, data) {
        console.log("BroCtrl--to-child:" + d + "," + data);        //平级得不到值
    });
});